package com.zjw.zy.componse.demo.fragment

import android.net.Uri
import android.widget.VideoView
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.viewinterop.AndroidView
import com.zjw.zy.componse.demo.base.BaseComposeFragment
import com.zjw.zy.componse.demo.base.BaseSlideView
import com.zjw.zy.componse.demo.ui.theme.MyApplicationTheme

/**
 * @author ：zhong.jw
 * @date ：Created in 2023/3/2 11:48
 */
class SlideFragment : BaseComposeFragment() {
    override fun onContentView(rootView: ComposeView) {
        rootView.setContent {
            MyApplicationTheme {
                Surface(modifier = Modifier.fillMaxSize()) {
                    AndroidView(factory = {
                        object : BaseSlideView(it) {
                            override fun onRequestUriData(id: Int): Uri {
                                return Uri.parse("https://vd2.bdstatic.com//mda-pbj3begv6p39k0f6//1080p//cae_h264//1676860043998133120//mda-pbj3begv6p39k0f6.mp4")
                            }

                            override fun onHasNext(id: Int): Boolean {
                                return id < 2
                            }

                        }
                    }, modifier = Modifier.fillMaxSize())
                }
            }
        }
    }

    override fun onSubscribeValue() {}
}